package net.adetech.crj.controller;

import com.alibaba.fastjson.JSON;
import net.adetech.crj.utils.InnerServiceUtil;
import net.adetech.framework.entity.ServiceRequest;
import net.adetech.framework.entity.ServiceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;


@RestController
public class DemoController {

    @Autowired
    InnerServiceUtil innerServiceUtil;



    @RequestMapping(value = "/demo",name="application/json")
    public String demo(int a, int b)
    {



        ServiceRequest request = new ServiceRequest();
        Map<String,Object> params = new HashMap<String, Object>();
        params.put("a",a);
        params.put("b",b);
        request.setParams(params);
        ServiceResponse response = innerServiceUtil.call("demo",request);
        return JSON.toJSONString(response.getResults());
    }
}
